import Vue from 'vue'
import App from './App.vue'
import router from './router';
import axios from './utils/axios';
import store from './store'

import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'

import './assets/font-awesome-4.7.0/css/font-awesome.min.css'
import './assets/scss/common.scss'

Vue.use(Mint);

Vue.config.productionTip = false
Vue.prototype.$axios = axios;

new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')

// 路由检查
const allowRouteName = ['login', 'logout', 'member_register'];
router.beforeEach((to, from, next) => {
  if(!allowRouteName.includes(to.name) && !sessionStorage.getItem('uid')) {
    next({name: 'login', replace: true})
  } else {
    next();
  }
});